﻿using HaierCADplug_in.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace HaierCADplug_in.ViewModel
{
    public class FigureWindowViewModel : INotifyPropertyChanged
    {
        public ObservableCollection<ImageData> Images { get; set; }

        public event PropertyChangedEventHandler PropertyChanged;

        public FigureWindowViewModel()
        {
            Images = new ObservableCollection<ImageData>();
            LoadImages(); // 假设你有一个加载图片的方法
        }
        private void LoadImages()
        {
            string directoryPath = "D:\\Leaning\\Picture";
            var imageLoader = new ImageData(); // 使用 ImageData 来加载图像
            imageLoader.LoadImages(directoryPath);
            foreach (var img in imageLoader.Images)
            {
                Images.Add(img);
            }
        }

        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }

        private ObservableCollection<Category> firstLevelCategories;

        public ObservableCollection<Category> FirstLevelCategories
        {
            get { return firstLevelCategories; }
            set { firstLevelCategories = value; NotifyPropertyChanged(); }
        }

        private Category selectedFirstLevelCategory;
        public Category SelectedFirstLevelCategory
        {
            get { return selectedFirstLevelCategory; }
            set
            {
                selectedFirstLevelCategory = value;
                NotifyPropertyChanged();
                
            }
        }

    }
}
